Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing /
Chapter 2 - Core Printing Features / Using Core Printing Features


Obtaining Information From a Format Object

This section provides an example of how to obtain information from a format object. QuickDraw GX provides functions that allow you to get, and in some cases set, the values of printing-related object properties.

This example uses the GXGetFormatDimensions function, which returns the dimensions property of a format object. The dimensions property includes the physical dimensions of the paper (the paper size) and the printable area within these dimensions (the page size) after scaling and orientation have been applied. For a discussion of how the dimensions can be scaled or otherwise changed, see the chapter "Page Formatting and Dialog Box Customization" in this book.

Listing 2-13 shows how to use the GXGetFormatDimensions function to obtain a format object's dimensions property.

Listing 2-13 Using the GXGetFormatDimensions function

OSErr MyGetFormatDimensions(MyDocumentPtr myDocument,
                              gxRectangle *pageBounds, 
                              gxRectangle *paperBounds)
{
   long           curPage;
   gxFormat       pgFormat;

/*
   Get the format object for the current page. If it is nil, use 
   the default format.
*/
   curPage = myDocument->curPage;
   pgFormat = myDocument->pageFormat[curPage -1];
   if (pgFormat == nil)
      pgFormat = GXGetJobFormat(myDocument->documentJob, 1);

/* Get the bounds of the format object.*/
   GXGetFormatDimensions(pgFormat, pageBounds, paperBounds);

   return GXGetJobError(myDocument->documentJob);
}
Note
The GXGetFormatDimensions function returns both the page size and the paper size of a particular document. Most applications are generally interested in only the page size, so QuickDraw GX allows you to pass nil for the pointer to the paper size.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help